import sys
import os

root_path = sys.argv[1]
folder_path = ['.vscode','src','include','lib']
launch_file = os.path.join(root_path,'.vscode','launch.json')
task_file = os.path.join(root_path,'.vscode','tasks.json')
makelist_file = os.path.join(root_path,'CMakeLists.txt')
main_file = os.path.join(root_path,'src','main.c')

file_name = {
    launch_file:'launch.json',
    task_file:'tasks.json',
    makelist_file:'CMakeLists.txt',
    main_file:'main.c'  
}
#!新建文件夹
for i in range(len(folder_path)):
    temp_path = os.path.join(root_path,folder_path[i])
    if os.path.exists(temp_path) ==False:
        os.mkdir(temp_path)      
#！写入文件，已存在文件则不处理
for key in file_name:
    if os.path.exists(key) ==False:
        with open(key,'w',encoding="utf-8") as f:
            with open(file_name[key],'r',encoding="utf-8") as f1:
                f.write(f1.read())
